# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import os
import os.path
import sys
import math

def pipe_write(sync_pi_name="/tmp/chiasyncpi", msg=None):
    if msg is None:
        return

    with open(sync_pi_name, "w") as ff:
        ff.write(str(msg)+"\n")
        ff.flush()
    return

def pipe_read(fd):
    return fd.readline()

def pipe_create(sync_pi_name="/tmp/chiasyncpi"):
    os.mkfifo(sync_pi_name)

def pipe_destory(sync_pi_name="/tmp/chiasyncpi"):
    if os.path.exists(sync_pi_name):
        os.unlink(sync_pi_name)

# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print('chiasynclib')
